import api from './api'; // 你的 api.js 应该是 axios 实例

export function getAllTeachers() {
  return api.get('/api/teachers/list');
}

export function getTeacherById(id) {
  return api.get(`/api/teachers/${id}`);
}

export function getTeacherByName(name) {
  return api.get(`/api/teachers/name/${name}`);
}

export function createTeacher(teacher) {
  return api.post('/api/teachers/add', teacher);
}

export function updateTeacher(teacher) {
  return api.put('/api/teachers/update', teacher); // 不要拼接 id
}

export function deleteTeacher(id) {
  return api.delete(`/api/teachers/delete/${id}`);
}